/**
 * 
 */
package edu.hm.compiler.parser.grammar.predicate;

import edu.hm.compiler.parser.grammar.Symbol;

/**
 * @author Saruman
 */
public class PredicateConstant implements Predicate
{
    private final Symbol symbol;

    public PredicateConstant( final Symbol symbol )
    {
        this.symbol = symbol;
    }

    @Override
    public Symbol getSymbol()
    {
        return this.symbol;
    }

    @Override
    public String toString()
    {
        return "PredicateConstant [symbol=" + this.symbol + "]"; //$NON-NLS-1$ //$NON-NLS-2$
    }

    /*
     * (non-Javadoc)
     * @see java.lang.Object#hashCode()
     */
    @Override
    public int hashCode()
    {
        final int prime = 31;
        int result = 1;
        result = prime * result + ( ( this.symbol == null ) ? 0 : this.symbol.hashCode() );
        return result;
    }

    /*
     * (non-Javadoc)
     * @see java.lang.Object#equals(java.lang.Object)
     */
    @Override
    public boolean equals( final Object obj )
    {
        if( this == obj )
            return true;
        if( obj == null )
            return false;
        if( this.getClass() != obj.getClass() )
            return false;
        final PredicateConstant other = (PredicateConstant) obj;
        if( this.symbol == null )
        {
            if( other.symbol != null )
                return false;
        } else if( !this.symbol.equals( other.symbol ) )
            return false;
        return true;
    }

}
